<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
      <script src="__PUBLIC__/plugins/formValidator/formValidator-4.1.3.js"></script>
   </head>
   <script>
   $(function () {
	   $.formValidator.initConfig({
		   theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){
				   edit();
			       return false;
			},onError:function(msg){
		}});
	   $("#communityName").formValidator({onShow:"",onFocus:"社区名称至少要输入1个字符",onCorrect:"输入正确"}).inputValidator({min:1,max:20,onError:"你输入的长度不正确,请确认"});
	   $("#areaId3").formValidator({onFocus:"请选择所属地区"}).inputValidator({min:1,onError: "请选择所属地区"});
	   <if condition="$object['communityId'] !=0 ">
	   getAreaList("areaId2",{$object.areaId1},0,{$object.areaId2});
	   getAreaList("areaId3",{$object.areaId2},1,{$object.areaId3});
	   </if>
   });
   function edit(){
	   var params = {};
	   params.id = $('#id').val();
	   params.agentLevel = $('#agentLevel').val();
	   params.agentProportion = $('#agentProportion').val();
	   params.minApplyPrice = $('#minApplyPrice').val();
	   params.maxApplyPrice = $('#maxApplyPrice').val();
	   params.applyDay = $('#applyDay').val();
	   params.agentLogDay = $('#agentLogDay').val();
	   params.status = $("input[name='status']:checked").val();
	   params.agentLogStatus = $("input[name='agentLogStatus']:checked").val();
	   params.applyPw = $("input[name='applyPw']:checked").val();
	   Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
	   $.post("{:U('Admin/Agent/settingEdit')}",params,function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
				   location.href='{:U("Admin/Agent/settingIndex")}';
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
		});
   }

   </script>
   <body class="wst-page">
       <form name="myform" method="post" id="myform" autocomplete="off">
        <input type='hidden' id='id' value='{$object.id}'/>
        <table class="table table-hover table-striped table-bordered wst-form">
           <tr>
             <th width='120' align='right'>返利级数：</th>
             <td><input type='text' id='agentLevel' class="form-control wst-ipt" value='{$object.agentLevel}' maxLength='25'/></td>
           </tr>


            <tr>
                <th width='120' align='right'>返利比例：</th>
                <td><input type='text' id='agentProportion' class="form-control wst-ipt" value='{$object.agentProportion}'/>格式：10%|5%|2%</td>
            </tr>


            <tr>
                <th width='130' align='right'>单次申请最小金额：</th>
                <td><input type='number' id='minApplyPrice' class="form-control wst-ipt" value='{$object.minApplyPrice}'/></td>
            </tr>

            <tr>
                <th width='130' align='right'>单次申请最大金额：</th>
                <td><input type='number' id='maxApplyPrice' class="form-control wst-ipt" value='{$object.maxApplyPrice}'/></td>
            </tr>



            <tr>
                <th width='130' align='right'>申请提现间隔天数：</th>
                <td><input type='number' id='applyDay' class="form-control wst-ipt" value='{$object.applyDay}'/></td>
            </tr>


            <tr style="display: none">
                <th align='right'>是否开启自动分佣：</th>
                <td>
                    <label>
                        <input type='radio' name='agentLogStatus' value='1' <if condition="$object['agentLogStatus'] ==1 ">checked</if> />开启&nbsp;&nbsp;
                    </label>
                    <label>
                        <input type='radio'  name='agentLogStatus' value='0' <if condition="$object['agentLogStatus'] ==0 ">checked</if> />关闭
                    </label>
                </td>
            </tr>

            <tr>
                <th width='130' align='right'>处理订单天数：</th>
                <td><input type='number' id='agentLogDay' class="form-control wst-ipt" value='{$object.agentLogDay}'/>说明：收货后{$object.agentLogDay}7天可处理分佣</td>
            </tr>



            <tr>
                <th align='right'>提现密码<font color='red'>*</font>：</th>
                <td>
                    <label>
                        <input type='radio' id='applyPw1' name='applyPw' value='1' <if condition="$object['applyPw'] ==1 ">checked</if> />开启&nbsp;&nbsp;
                    </label>
                    <label>
                        <input type='radio' id='applyPw0' name='applyPw' value='0' <if condition="$object['applyPw'] ==0 ">checked</if> />关闭
                    </label>
                </td>
            </tr>

           <tr>
             <th align='right'>是否开启<font color='red'>*</font>：</th>
             <td>
             <label>
             <input type='radio' id='status1' name='status' value='1' <if condition="$object['status'] ==1 ">checked</if> />开启&nbsp;&nbsp;
             </label>
             <label>
             <input type='radio' id='status0' name='status' value='0' <if condition="$object['status'] ==0 ">checked</if> />关闭
             </label>
             </td>说明：关闭后 重置所有店铺分销状态
           </tr>
           <tr>
             <td colspan='2' style='padding-left:250px;'>
                 <button type="submit" class="btn btn-success">保&nbsp;存</button>
                 <button type="button" class="btn btn-primary" onclick='javascript:location.href="{:U('Admin/Agent/settingIndex')}"'>返&nbsp;回</button>
             </td>
           </tr>
        </table>
       </form>
   </body>
</html>